<?php

class mysqlClient {
  var $debug = array();

	function __construct($server = 'localhost', $database = 'LIND', $usergroup = 'LIND', $passwordOfUsergroup = 'LIND') {
		if (!@mysql_connect('localhost', $usergroup, $passwordOfUsergroup)) {
			$this->debug[] = 'no server connection';
			return false;
		}

		if (!mysql_select_db($database)) {
			$this->debug[] = 'no db';
			return false;
		}

		return true;
	}

	function getData($query, $row = 'makeArray', $column = 'makeArray') {
		$table = mysql_query($query);
		
		if (!$table) {
			$this->debug[] = 'problems with query ' . mysql_error();
			return false;
		}

    if ($row == 'makeArray') {
      while ($row = mysql_fetch_array($table, MYSQL_BOTH)) {
        $array[] = $row;
      }
      
      return $array;
    }
    
    else {
		  return mysql_result($table, $row, $column);
    }

	}

	function putData($query) {
		if (!mysql_query($query)) {
			$this->debug[] = 'problems with query ' . mysql_error();
			return false;
		}

		return true;
	}
}
?>
